import apiAxios from './apiAxios'
import mockAxios from './mockAxios'
//获取三级分类数据
export const getBaseCategoryList = () => apiAxios.get('/product/getBaseCategoryList')
//获取搜索数据
export const getSearchList = (options = {}) => apiAxios.post('/list', options)
//获取详情页数据
export const getDetail = (id) => apiAxios.get(`/item/${id}`)
//添加购物车
export const addToCart = (skuId, skuNum) => apiAxios.post(`/cart/addToCart/${skuId}/${skuNum}`)
//获取购物车列表
export const getCartList = () => apiAxios.get('/cart/cartList')
//切换商品选中状态
export const checkState = (skuID, isChecked) => apiAxios.get(`/cart/checkCart/${skuID}/${isChecked}`)
//删除购物车商品
export const deleteCart = (skuId) => apiAxios.delete(`/cart/deleteCart/${skuId}`)
//用户注册
export const register = (phone, password, code, nickName = '') => apiAxios.post('/user/passport/register', {
    phone, password, code, nickName
})
//用户登录
export const login = (phone, password) => apiAxios.post('/user/passport/login', { phone, password })
//自动登录
export const getUserInfo = () => apiAxios.get('/user/passport/auth/getUserInfo')
//退出登录
export const logout = () => apiAxios.get('/user/passport/logout')
//获取交易信息
export const getTradeInfo = () => apiAxios.get('/order/auth/trade')
//获取订单列表
export const getOrderInfo = (page, limit) => apiAxios.get(`/order/auth/${page}/${limit}`)
//提交订单
export const submitOrder = (tradeNo, order) => apiAxios.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,order)
//获取支付信息
export const getPayInfo = (orderId) => apiAxios.get(`/payment/weixin/createNative/${orderId}`)
//获取订单状态
export const geyPayStatus = (orderId) => apiAxios.get(`/payment/weixin/queryPayStatus/${orderId}`)

//mock 轮播图数据和楼层数据
export const getBanners = () => mockAxios.get('/banners')
export const getFloor = () => mockAxios.get('/floor')